<template>
    <view class="page">
        <view>
            <view class="top">
                <image style="width: 88rpx;height: 88rpx;margin-left: 30rpx;" :src="avatar?avatar:'https://www.diandianyouke.site:801/fileDataBase/static/stag/static/img/user_icon_HeadSculpture.png'"/>
                <text style="margin-left: 18rpx;">{{ name }}</text>
            </view>
            <textarea v-model="content" class="textarea" placeholder-style="color:rgb(144,147,153);font-size:28rpx" placeholder="Hi,请输入你对店店有客的反馈或建议吧~" />
            <button class="btn" @click="getFeed">提交</button>
        </view>        
    </view>
</template>

<script>
import { httpRequest } from '../../utils/http';
export default {
    name: 'UniPresetVueVite1Idea',

    data() {
        return {
            content:'',
            avatar:uni.getStorageSync('business').businessImg,
            name:uni.getStorageSync('business').weChatName
        };
    },

    methods: {
        async getFeed(){
            if(!this.content)return uni.showToast({title:"不能提交空的建议~"})
            const res = httpRequest('/api/addFeedback','POST',{
                businessId:uni.getStorageSync('business').businessId,
                content:this.content
            })
            console.log(res);
            this.content=''
            uni.showToast({title:'提交成功',icon:'none'})
        }
    },
};
</script>

<style lang="scss" scoped>
    .page{
        box-sizing: border-box;
        position: absolute;
        width: 100%;
        height: 100%;
        background-color: #fff;
        padding: 48rpx 30rpx;
        .top{
            display: flex;
            align-items: center;
            font-size: 40rpx;
            color: rgb(48,49,51);
            margin-bottom: 42rpx;
        }
        .textarea{
            box-sizing: border-box;
            width: 690rpx;
            height: 304rpx;
            background-color: rgb(249,249,249);
            border-radius: 24rpx;
            padding: 30rpx;
            margin-bottom: 22rpx;
        }
        .btn{
            width: 156rpx;
            height: 64rpx;
            background-color: rgb(142,84,244);
            color: #fff;
            text-align: center;
            line-height: 64rpx;
            float: right;
            border-radius: 402rpx;
            font-size: 30rpx;
        }
    }
</style>